<template>
    <div v-html="svgContent" style="width:100%"></div>
</template>
<script setup>
import { ref, onMounted, defineEmits } from 'vue'; 
const svgContent = ref(null); // 用于存储SVG内容  
const queryParams = new URLSearchParams(window.location); // 解析URL查询参数  
const ip = queryParams.get('hostname'); // 假设IP地址是通过查询参数传递的  
const baseURL = process.env.VITE_BASE_URL;
console.log("baseURL:"+baseURL)
const emit = defineEmits(['dataLoaded']);

onMounted(() => {
  loadSvg()
})
async function loadSvg() {
    const response = await fetch(baseURL+ip+'B.svg');  
    if (!response.ok) {  
      throw new Error('Failed to fetch SVG file');  
    } 
    svgContent.value = await response.text();
    emit('dataLoaded');
}
</script>
